import api from '@/api/customer'

const state = {
    rows: [],
    count: 0,
}

const actions = {
    //加载客户信息
    async loadCustomers({ commit, state }, listQuery = {}) {
        let { where } = listQuery
        let response = await api.index({
            page: listQuery.page || 1,
            limit: listQuery.limit || 1000,
            where,
        })
        commit('updateState', response.data)
    },

}

const mutations = {
    updateState(state, stateData) {
        Object.assign(state, stateData)
    },
}


export default {
    namespaced: true,
    state,
    actions,
    mutations
}